#!/bin/bash
#get screen resolution
res="$(xrandr|grep '*'|head -n 1|awk '{print $1}')"

#get width and height
width="$(xrandr|grep '*'|head -n 1|awk '{print $1}'|cut -d\x -f1)"
height="$(xrandr|grep '*'|head -n 1|awk '{print $1}'|cut -d\x -f2)"

#output
echo "Your screen Resolution is $res"

echo "The width is $width and the height is $height"